<div class="box box-solid no-margin box-show">
    <div class="box-body">
        <h4>装箱明细</h4>
        <div class="box-body table-responsive no-padding">
            <table class="table table-hover">
                <thead>
                <tr>
                    <th>箱号</th>
                    <th>箱数</th>
                    <th>装箱编号</th>
                    <th>FnSKU</th>
                    <th>SKU</th>
                    <th>单箱数量</th>
                    <th>状态</th>
                    <th>处理时间</th>
                    <th>长(CM)</th>
                    <th>宽(CM)</th>
                    <th>高(CM)</th>
                    <th>重(KG)</th>
                </tr>
                </thead>
                <tbody>
                @php
                    $boxNo = [];
                @endphp
                @foreach($delivery->box as $row)
                    @foreach($row->box_detail as $item)
                        @php
                            if(!array_key_exists($row->box_no,$boxNo)){
                                $boxNo[$row->box_no] = 1;
                            }else{
                                $boxNo[$row->box_no] += 1;
                            }
                        @endphp
                        <tr>
                            @if($boxNo[$row->box_no] == 1)
                                <td>{{ $row->box_no }}</td>
                                <td>{{ $row->total }}</td>
                            @else
                                <td></td>
                                <td></td>
                            @endif
                            <td>{{ $row->box_no . ($row->total > 1 ? '-'.$item->p_index : '') }}</td>
                            <td>{{ $row->fnsku }}</td>
                            <td>{{ $row->sku->psku_code ?? '' }}</td>
                            <td>{{ $row->num_per_box }}</td>
                            <td>{{ \App\Models\OverSeasIn\DeliveryBoxDetail::$_status[$item->status] }}</td>
                            <td>{{ $item->deal_at }}</td>
                            @if($boxNo[$row->box_no] == 1)
                                <td>{{ $row->long }}</td>
                                <td>{{ $row->wide }}</td>
                                <td>{{ $row->high }}</td>
                                <td>{{ $row->weight }}</td>
                            @else
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                            @endif
                        </tr>
                    @endforeach
                @endforeach
                </tbody>
            </table>
        </div>
    </div>
</div>
